package com.primeton.whdc.ccms.reportboot;

import org.springframework.util.AntPathMatcher;

/**
 * @author: YunTao.Li
 * @create: 2020-07-22 00:11
 * @description:
 **/
public class test2 {

    public static void main(String[] args) {
        AntPathMatcher antPathMatcher = new AntPathMatcher();
        String pattern = "/conference/room/category/{catId}";
        String path = "/ccms/conference/room/category/list";

        String newPattern = "";
        // step2.1 : 将/{xxx}匹配全部换成 / *
        for (String pattern_char : pattern.split("/")) {
            if (pattern_char.startsWith("{") && pattern_char.endsWith("}")) {
                pattern_char = "*";
            }
            newPattern += "/" + pattern_char;
        }
        newPattern = newPattern.replace("//", "/");
        if (antPathMatcher.match(newPattern, path)) {
//            record.setApiName(api.getApidesc());
//            record.setAppName(api.getAppname());
//            break;
            System.out.println(111111);
        } else {
            newPattern = "/ccms" + newPattern;
            if (antPathMatcher.match(newPattern, path)) {
//                record.setApiName(api.getApidesc());
//                record.setAppName(api.getAppname());
//                break;
                System.out.println(2222222);
            }
        }
    }
    public void main(){

    }
}
